From b21e996a89a9fe2acb09136792c75b1dd8eb59f8 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Mon, 29 Apr 2024 08:55:55 -0300 Subject: [PATCH] Change web app methods do use nostrsigner: instead of intent: --- 100.md | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/100.md b/100.md index 06d6b35..99feebf 100644 --- a/100.md +++ b/100.md @@ -432,63 +432,49 @@ Android intents and browsers url has limitations, so if you are using the return - params: ```js - const intent = `intent:#Intent;scheme=nostrsigner;S.compressionType=none;S.returnType=signature;S.type=get_public_key;S.callbackUrl=https://example.com/?event=;end`; - - window.href = intent; + window.href = `nostrsigner:?compressionType=none;returnType=signature;type=get_public_key;callbackUrl=https://example.com/?event=`; ``` - **sign_event** - params: ```js - const intent = `intent:${eventJson}#Intent;scheme=nostrsigner;S.compressionType=none;S.returnType=signature;S.type=sign_event;S.callbackUrl=https://example.com/?event=;end`; - - window.href = intent; + window.href = `nostrsigner:${eventJson}?compressionType=none;returnType=signature;type=sign_event;callbackUrl=https://example.com/?event=`; ``` - **nip04_encrypt** - params: ```js - const intent = `intent:${plainText}#Intent;scheme=nostrsigner;S.pubKey=${hex_pub_key};S.compressionType=none;S.returnType=signature;S.type=nip04_encrypt;S.callbackUrl=https://example.com/?event=;end`; - - window.href = intent; + window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key};compressionType=none;returnType=signature;type=nip04_encrypt;callbackUrl=https://example.com/?event=`; ``` - **nip44_encrypt** - params: ```js - const intent = `intent:${plainText}#Intent;scheme=nostrsigner;S.pubKey=${hex_pub_key};S.compressionType=none;S.returnType=signature;S.type=nip44_encrypt;S.callbackUrl=https://example.com/?event=;end`; - - window.href = intent; + window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key};compressionType=none;returnType=signature;type=nip44_encrypt;callbackUrl=https://example.com/?event=`; ``` - **nip04_decrypt** - params: ```js - const intent = `intent:${encryptedText}#Intent;scheme=nostrsigner;S.pubKey=${hex_pub_key};S.compressionType=none;S.returnType=signature;S.type=nip04_decrypt;S.callbackUrl=https://example.com/?event=;end`; - - window.href = intent; + window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key};compressionType=none;returnType=signature;type=nip04_decrypt;callbackUrl=https://example.com/?event=`; ``` - **nip44_decrypt** - params: ```js - const intent = `intent:${encryptedText}#Intent;scheme=nostrsigner;S.pubKey=${hex_pub_key};S.compressionType=none;S.returnType=signature;S.type=nip44_decrypt;S.callbackUrl=https://example.com/?event=;end`; - - window.href = intent; + window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key};compressionType=none;returnType=signature;type=nip44_decrypt;callbackUrl=https://example.com/?event=`; ``` - **decrypt_zap_event** - params: ```js - const intent = `intent:${eventJson}#Intent;scheme=nostrsigner;S.compressionType=none;S.returnType=signature;S.type=decrypt_zap_event;S.callbackUrl=https://example.com/?event=;end`; - - window.href = intent; + window.href = `nostrsigner:${eventJson}?compressionType=none;returnType=signature;type=decrypt_zap_event;callbackUrl=https://example.com/?event=`; ``` ## Example @@ -518,7 +504,7 @@ Android intents and browsers url has limitations, so if you are using the return } let encodedJson = encodeURIComponent(JSON.stringify(json)) var newAnchor = document.createElement("a"); - newAnchor.href = `intent:${encodedJson}#Intent;scheme=nostrsigner;S.compressionType=none;S.returnType=signature;S.type=sign_event;S.callbackUrl=https://example.com/?event=;end`; + newAnchor.href = `nostrsigner:${encodedJson}?compressionType=none;returnType=signature;type=sign_event;callbackUrl=https://example.com/?event=`; newAnchor.textContent = "Open External Signer"; document.body.appendChild(newAnchor) }